﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DataAccessor.Example
{
    public partial class FormPrimary : Form
    {
        public FormPrimary()
        {
            InitializeComponent();
            LoadEmployees();
        }

        private void tbtnInsert_Click(object sender, EventArgs e)
        {
            FormAddEmployee form = new FormAddEmployee();
            form.ShowInTaskbar = false;
            form.Show(this);
        }

        private void LoadEmployees()
        {
            var datasource = Program.DA.ExecuteDataSet("Get all employees").Tables[0];
            // var datasource = Program.DAMySql.ExecuteDataSet("Get all user").Tables[0];

            this.gridEmployees.DataSource = datasource;
        }

        private void tbtnRefresh_Click(object sender, EventArgs e)
        {
            LoadEmployees();
        }
    }
}
